package dao.impl;
 
 import dao.UserDao;
 import org.apache.ibatis.io.Resources;
 import org.apache.ibatis.session.SqlSession;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.apache.ibatis.session.SqlSessionFactoryBuilder;
 import pojo.User;
 import utils.MyBatisUtil;

 import java.io.IOException;
 import java.io.InputStream;
 import java.sql.*;
 import java.util.ArrayList;
 import java.util.List;
 
 public class UserDaoImpl  implements UserDao {
     @Override
     public List<User> findAll() {

         return MyBatisUtil.getSession().getMapper(UserDao.class).findAll();
 
     }

     @Override
     public int addUser(User user){
         SqlSession session = MyBatisUtil.getSession();
         int result = session.getMapper(UserDao.class).addUser(user);
         session.commit();
         return result;
     }
 }
